
using namespace System;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using namespace System::Drawing;


namespace Chess
{
	public ref class ChessPanel : Panel
	{
	public:
		int row()  { return _row; }
		void row(int val) { _row = val; }
		int column() { return _col; }
		void column(int val) { _col = val; }


		int BorderWidth() { return _borderWidth; }
		void BorderWidth(int val)  { _borderWidth = val >= 0 ? val : 0; }
		Color BorderColor() { return _borderColor; }
		void BorderColor(Color val) { _borderColor = val; }
		ButtonBorderStyle BorderStyle2() { return _borderStyle2; }
		void BorderStyle2(ButtonBorderStyle val) { _borderStyle2 = val; }

		ChessPanel(int row, int col)
			: Panel()
		{
			_row = row;
			_col = col;
			_borderColor = Color::Yellow;
			_borderWidth = 0;
			_borderStyle2 = ButtonBorderStyle::Solid;

		}

	private:
		int _row;
		int _col;
		int _borderWidth;
		ButtonBorderStyle _borderStyle2;
		Color _borderColor;

	protected: 
		virtual void OnPaint(PaintEventArgs ^e) override
		{
			Panel::OnPaint(e);

			ControlPaint::DrawBorder(e->Graphics, ClientRectangle,
				BorderColor(), BorderWidth(), this->BorderStyle2(),
				BorderColor(), BorderWidth(), this->BorderStyle2(),
				BorderColor(), BorderWidth(), this->BorderStyle2(),
				BorderColor(), BorderWidth(), this->BorderStyle2());
		}

	public:
		virtual bool Equals(ChessPanel^ value) override
		{
			if(value == nullptr)
				return false;
			if(value->row() == this->row() && value->column() == this->column())
				return true;
			return false;
		}
	};
}
